#ifndef __LINKLIST_H__
#define __LINKLIST_H__

typedef struct linknode{
	void *data;
	struct linknode *next;
}node_t;

typedef struct firstlink{
	struct linknode head;
	int size;
}list;

typedef int (*cmp_t)(const void *data1, const void *data2);
typedef void(*pri_t)(const void *data1);
//初始化
int list_init(list ** mylist, const int size);
//增
int list_insert(list *mylist, const void *data1);
int list_insert_tail(list *mylist, const void *data1);

//查
void *list_search(const list *mylist, const void *data1, cmp_t cmp);
//删
int list_delete(list *mylist, const void *data1, cmp_t cmp);
//改
int list_updata(const list *mylist, const void *data1, const void *data2, cmp_t cmp);
//展示
int list_display(const list *mylist, pri_t pri);
//销毁
void list_destroy(list **mylist);

//两级反转
int list_reverse(list *mylist);

//判满
int list_circle(const list *mylist);

//中值
void *list_get_mid(const list *mylist);


#endif
